﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Admin_DiyPage.aspx.cs"
    Inherits="V5_EShop.Admin.DiyPage.Admin_DiyPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
</html>
<head runat="server">
    <title></title>
    <%=V5.Load.LoadAdminHeader(this)%>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table border="0" cellpadding="0" cellspacing="0" class="tablelist">
            <tr>
                <td class="headertext">
                    单页图文
                </td>
            </tr>
            <tr>
                <td>
                    <a href="?">管理首页</a> | <a href="?Action=edit">添加单页图文</a>
                </td>
            </tr>
        </table>
        <asp:MultiView ID="MultiViewList" runat="server" ActiveViewIndex="0">
            <asp:View ID="View1" runat="server">
                <table border="0" cellpadding="0" cellspacing="0" class="tablelist">
                    <tr>
                        <td>
                            操作:<asp:DropDownList ID="ddlOpID" runat="server">
                                <asp:ListItem Text="请选择一个操作" Value="0" />
                                <asp:ListItem Text="删除所选" Value="1" />
                            </asp:DropDownList>
                            <asp:Button ID="btnExeSeleted" runat="server" Text="执行所选" OnClick="btnExeSeleted_Click" />
                            <input id="Button1" type="button" value="生成所选Html" onclick="CreateDiyPageSelected(this);" />
                        </td>
                    </tr>
                </table>
                <asp:GridView ID="gvList" runat="server" AutoGenerateColumns="False" GridLines="None"
                    OnRowCommand="gvList_RowCommand" CssClass="tablelist rowlist overlist" EnableModelValidation="True">
                    <HeaderStyle CssClass="headertext" />
                    <Columns>
                        <asp:TemplateField HeaderText="选择">
                            <HeaderTemplate>
                                <input id="Checkbox1" type="checkbox" onclick="SelectAll(this)" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="chkItem" runat="server" CssClass="chkselected" />
                            </ItemTemplate>
                            <ItemStyle Width="20px" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="ID" HeaderText="ID">
                            <ItemStyle HorizontalAlign="Center" Width="40px" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="名称">
                            <ItemTemplate>
                                <%#Eval("DiyName")%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="分类名称">
                            <ItemTemplate>
                                <%# BindClass(Eval("ClassID")).ClassName == null ? "未归档" : BindClass(Eval("ClassID")).ClassName%>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="60px" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="PagePath" HeaderText="文件路径" />
                        <asp:TemplateField HeaderText="操作">
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" CommandArgument='<%# Bind("ID")%>' CommandName="go"
                                    runat="server">修改</asp:LinkButton>
                                <asp:LinkButton ID="LinkButton2" CommandArgument='<%# Bind("ID")%>' CommandName="del"
                                    runat="server" OnClientClick="return confirm('你确定是否删除!');">删除</asp:LinkButton>
                                <a onclick="CreateDiyPage(this,'<%#Eval("ID") %>')" href="#">更新</a>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="200px" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <table cellpadding="0" cellspacing="0" class="tablelist">
                    <tr>
                        <td>
                            <webdiyer:AspNetPager ID="Pager" runat="server" CustomInfoHTML="共%PageCount%页，当前为第%CurrentPageIndex%页，每页%PageSize%条"
                                FirstPageText="首页" HorizontalAlign="Right" LastPageText="尾页" NextPageText="下一页"
                                OnPageChanged="Pager_PageChanged" PageIndexBoxType="DropDownList" PageSize="20"
                                PrevPageText="上一页" ShowCustomInfoSection="Left" ShowPageIndexBox="Always" SubmitButtonText="Go"
                                TextAfterPageIndexBox="页" TextBeforePageIndexBox="转到" AlwaysShow="True" Width="100%">
                            </webdiyer:AspNetPager>
                        </td>
                    </tr>
                </table>
                <script type="text/javascript">
                    function CreateDiyPage(me, id) {
                        var d = "createhtml.ashx?Action=makepage&ID=" + id;
                        submitIframe(d);
                    }
                    function CreateDiyPageSelected(me) {
                        var IDs = [];
                        $(".chkselected").each(function (a, b, c, d) {
                            if ($(b).attr("checked") == true) {
                                //alert($(b).attr("value"));
                                //CreateDiyPage(me, $(b).attr("value"));
                                IDs.join($(b).attr("value"));
                            }
                        });
                        var d = "createhtml.ashx?Action=createalldiypage&ID=" + IDs;
                        submitIframe(d);
                    }
                    function submitIframe(url) {
                        $("#CreateHtml").attr("src", url);
                    }
                </script>
                <table border="0" cellpadding="0" cellspacing="0" class="tablelist">
                    <tr>
                        <td class="header">
                            生成结果!
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" id="HtmlHtml">
                            <iframe frameborder="0" id="CreateHtml" name="CreateHtml" style="border: 0; height: 100%;
                                width: 100%;" scrolling="auto"></iframe>
                        </td>
                    </tr>
                </table>
            </asp:View>
            <asp:View ID="View2" runat="server">
                <table cellpadding="0" cellspacing="0" class="tablelist">
                    <tr>
                        <td colspan="2" class="headertext">
                            <asp:Label ID="lblTitle" runat="server" Text="添加单页图文"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 25%;">
                            名字
                        </td>
                        <td>
                            <asp:TextBox ID="txtDiyName" runat="server" Width="382px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            所属分类
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlClassList" runat="server">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            文件地址
                        </td>
                        <td>
                            <asp:TextBox ID="txtPagePath" runat="server" Width="327px"></asp:TextBox>
                            请输入.htm或.html的英文名称
                        </td>
                    </tr>
                    <tr>
                        <td>
                            是否使用模板
                        </td>
                        <td>
                            <input id="chkUserTemplate" type="checkbox" value="1" runat="server" onclick="checkTemplate()" />使用
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Url跳转：
                        </td>
                        <td>
                            <asp:TextBox ID="txtJumpUrl" runat="server" Width="381px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="seo123">
                        <td class="style1">
                            模板文件
                        </td>
                        <td class="style1">
                            <asp:TextBox ID="txtTemplate" runat="server"></asp:TextBox>*.ascx 模板目录开始
                        </td>
                    </tr>
                    <tr class="seo123">
                        <td>
                            页面标题
                        </td>
                        <td>
                            <asp:TextBox ID="txtPageTitle" runat="server" Width="384px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="seo123">
                        <td>
                            页面关键字
                        </td>
                        <td>
                            <asp:TextBox ID="txtPageKeyWords" runat="server" Height="50px" TextMode="MultiLine"
                                Width="481px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr class="seo123">
                        <td>
                            页面描述
                        </td>
                        <td>
                            <asp:TextBox ID="txtPageDescription" runat="server" Height="55px" TextMode="MultiLine"
                                Width="481px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            内容
                        </td>
                        <td>
                            <asp:TextBox ID="txtPageContent" runat="server" TextMode="MultiLine"></asp:TextBox>
                            <script type="text/javascript">
        			        //<![CDATA[
                                CKEDITOR.replace('<%= this.txtPageContent.ClientID %>',
					        {
					            skin: 'v2',
					            height: 350,
					            resize_enabled: false
					        });
        			        //]]>
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2">
                            <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="添加并保存" />
                            <asp:HiddenField ID="hfID" runat="server" Value="0" />
                        </td>
                    </tr>
                </table>
                <script type="text/javascript">
                    function checkTemplate() {
                        var p = $("#<%=this.chkUserTemplate.ClientID %>");
                        if (p.attr("checked") == true) {
                            $(".seo123").css("display", "");
                        } else if (p.attr("checked") == false) {
                            $(".seo123").css("display", "none");
                        }
                    }
                    $(function () {
                        checkTemplate();
                    });
                </script>
            </asp:View>
        </asp:MultiView>
    </div>
    </form>
</body>
</html> 